package com.reader;

import java.io.File;
import java.io.FilenameFilter;

/**
 * @author ShreeDaa
 *
 */
public class LogFilenameFilter implements FilenameFilter {

	@Override
	public boolean accept(File dir, String name) {
		String fileExtension = getExtension(name);
		if (fileExtension.equalsIgnoreCase(LogReader.LogFileExtension)) {
			return true;
		}
		return false;
	}
	
	/**
	 * Just to Get the File Extension.
	 * 
	 * @param fileName
	 * @return .extension as String.
	 */
	private String getExtension(String fileName) {
		return fileName.substring(fileName.lastIndexOf('.'), fileName.length());
	}


}
